<?php
$config = Zend_Registry::get('config');
$siteLanguages = $config->language->translations;
$language = $this->currentVersion;?>

<p class="padding-10"><?php echo $this->getTranslation('Current Version') . ': ';?>
    <strong><?php
        echo $this->getTranslation($siteLanguages->$language);?>
    </strong>
</p>
<p><?php

if ($siteLanguages) {
    echo $this->getTranslation('Available Languages') . ':';
}

if ($siteLanguages) {?>
    <ul class="padding-10"><?php
    $pageMdl = new Model_Page();
    $pageVersions = $pageMdl->getVersions($this->pageId);
    $defaultVersion = $pageMdl->getDefaultLanguage();

    foreach ($siteLanguages as $key => $language) {
        $language = $this->getTranslation($language);
        if (isset($pageVersions[$key])) {
            $icon = 'flag_green.png';
        } else {
            $icon = 'flag_red.png';
        }
        if ($key == $defaultVersion) {
            $language = '<strong>' . $language . '</strong>';
            $language .= ' (' . $this->getTranslation('Default') . ')';
        }
        echo '<li>' .
                    $this->link($language, '/admin/page/edit/id/' . $this->pageId . '/language/' . $key, $icon) .
                    $this->renderImage('images/icons/flags/' . $key . '.png') .
             '</li>';
    }?>
    </ul><?php
}?>
</p>